package com.xjoyt.pay.gateway.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xjoyt.pay.dto.AccessParam;
import com.xjoyt.pay.dto.ExecuteResult;
import com.xjoyt.pay.dto.PageParam;
import com.xjoyt.pay.dto.PageResult;
import com.xjoyt.pay.gateway.annotations.RestApi;
import com.xjoyt.pay.gateway.constants.RestApiConstant;
import com.xjoyt.pay.share.interfaces.BankContract;
import com.xjoyt.pay.share.params.BankPageParam;
import com.xjoyt.pay.share.po.Bank;

@RestController
@RequestMapping("bank")
public class BankController extends GatewayAbstractController {

    @Autowired
    private BankContract contract;

    /**
     * 获取银行
     * 
     * @param param
     * @return
     */
    @RestApi(value = RestApiConstant.BANK_PAGE, name = "获取银行分页列表")
    @PostMapping("loadPage")
    public ExecuteResult<PageResult<Bank>> loadPage(
            @RequestBody(required = false) AccessParam<PageParam<BankPageParam>> param) {
        return ExecuteResult.ok(contract.loadPage(param.param));
    }

}
